#!/usr/bin/python
# -*- coding: UTF-8 -*-
# 带参数的装饰器
class dec4_monitor(object):
    def __init__(self, level = 'INFO'):
        print(level)
        self.level = level

    def __call__(self, func): # 接收函数
        def call_inner(*args, **kwargs):
            print("[%s]:%s is running" %(self.level, func.__name__))
            func(*args, **kwargs)
        return call_inner    # 返回函数

@dec4_monitor(level = 'WARNING')
def func_warm(warn):
    print(warn)

func_warm("WARNING Message!")